import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

driver = webdriver.Edge()

# 打开页面
driver.get("http://127.0.0.1:8080/student/client/msg/100000")



# 获取 div 元素
driver.find_element(By.NAME, "number").send_keys("23")
driver.find_element(By.NAME, "password").send_keys("123")

time.sleep(6)

# 模拟回车键的操作
driver.find_element(By.NAME, "password").send_keys(Keys.RETURN)
time.sleep(15)

# 切换iframe
iframe_element = driver.find_element(By.CLASS_NAME, "iframe_msg")
driver.switch_to.frame(iframe_element)


for i in range(0, 1000):
    div_element = driver.find_element(By.ID, "msg")
    div_element.send_keys(i)
    div_element.send_keys(Keys.RETURN)
    time.sleep(1)


input("按下任意键继续...")
